package com.ruan.controller;

import com.ruan.entity.R;
import com.ruan.service.ShoppingcartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @ClassName:ShoppingCartController
 * @Author:阮昇
 * @Description:
 * @Datetime: 2023/9/25 23:47
 **/
@Api(tags = "购物车相关接口")
@RestController
@RequestMapping("/shoppingCart")
public class ShoppingCartController {

    @Autowired
    private ShoppingcartService shoppingcartService;

    @ApiOperation(value = "添加购物车")
    @ApiImplicitParam(name = "map", value = "购物车信息", dataType = "Map", paramType = "query")
    @PostMapping("/addShoppingCart")
    @PreAuthorize("hasAuthority('addShoppingCart')")
    public R<Void> addShoppingCart(@RequestBody Map<String,Integer> map){
        return shoppingcartService.addShoppingCart(map);
    }
}
